package jdkc;

/*
 *@Student 张策
 */


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/*
 *@Student 张策
 */
public class jdbc5 {
    public static void main(String[] args) throws Exception {
        //导入对应的数据库驱动jar包
        //注册驱动
        //获取数据库连接对象
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db6", "root", "111111");
        //定义sql语句
        String sql="select*from acc";
        //获取执行sql的对象 Statement
        Statement state = conn.createStatement();
        //执行sql
        ResultSet res = state.executeQuery(sql);
        res.next();
        int anInt = res.getInt(1);
        String string = res.getString("name");
        double anInt1 = res.getDouble(3);
        System.out.println(anInt+string+anInt1);
        //释放资源
        state.close();
        conn.close();
        res.close();
    }
}

